﻿#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QDebug>
#include <QBoxLayout>
#include <QDir>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
//    this->setStyleSheet("#MainWindow{border-image:url(\"background.png\");}");
    m_view = new QWebEngineView(ui->centralWidget);
//    m_view->page()->setBackgroundColor(QColor(0,0,0,0));
//    m_view->setAttribute(Qt::WA_TranslucentBackground);

    QString strPath = QDir::currentPath();
//    QString file = QString("%1/3dball.html").arg(strPath);
    QString file = QString("%1/3dzhuzhuangtu.html").arg(strPath);
    qDebug() << file.toUtf8().data();
    m_view->load(QUrl(file));
    QLabel *label = new QLabel(this);
    label->setScaledContents(true);
    label->setPixmap(QPixmap("1525307469.png"));
    label->setFixedSize(180,180);

    QWidget *widget = new QWidget(ui->centralWidget);
    widget->setFixedSize(700,800);
    QHBoxLayout *H0 = new QHBoxLayout(widget);
    H0->addWidget(m_view);
    H0->setMargin(0);
    H0->setSpacing(0);
    QVBoxLayout *V = new QVBoxLayout(ui->centralWidget);
    QHBoxLayout *Hv = new QHBoxLayout(ui->centralWidget);
    Hv->addWidget(label);
    Hv->addWidget(widget);
    V->addLayout(Hv);
    V->setSpacing(0);
    V->setMargin(0);
}

MainWindow::~MainWindow()
{
    delete ui;
}
